﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using Tulde.WindowsPhone.Music;

namespace MP3tunes.LockerPlayer
{
    public static class NavigationServiceExtensions
    {
        public static void NavigateWithViewModels(this System.Windows.Navigation.NavigationService service,string uri, params object[] instances)
        {
            List<string> urlsParams = new List<string>();
            foreach (var item in instances)
            {
                urlsParams.Add(ViewModelSerializerFactory.Instance.SerializeToUrlParameter(item));
            }
            Uri url = new Uri(uri + "?" + String.Join("&", urlsParams.ToArray()), UriKind.Relative);
            service.Navigate(url);
        }
    }
}
